#该脚本是输入两个时间，获得之间隔的时间天数
import argparse
from datetime import datetime
def Parse_Arguments():
    parser = argparse.ArgumentParser(description="Calculate the number of days between two dates")
    parser.add_argument('--before_date', default="20231218", type=str, help="Start date in YYYYMMDD format")
    parser.add_argument('--after_date', default="20250601", type=str, help="Start date in YYYYMMDD format")
    return parser.parse_args()

def main():
    args = Parse_Arguments()
    # 将字符串日期转换为 datetime 对象
    date_format = "%Y%m%d"
    before_date = datetime.strptime(args.before_date, date_format)
    after_date = datetime.strptime(args.after_date, date_format)
    # 计算两个日期之间的差异
    time_delta = after_date - before_date
    # 打印天数差异
    print(f"The number of days between {args.before_date} and {args.after_date} is {time_delta.days} days.")
if __name__ == "__main__":
    main()
